import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)



const rank = (resolve) => {
  import('views/rank').then((module) => {
    resolve(module);
  })
}



const viewRouter = new Router({
  routes: [
    {
      path: '/',
      component: rank,
      meta: {
        title: '会员购买'
      }
    }

  ]
})

viewRouter.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title;
  }
  let uid = to.query.uid || localStorage.getItem('uid');
  let token = to.query.token || localStorage.getItem('token');
  next();
  setTimeout(()=>{
    localStorage.setItem('uid', uid);
    localStorage.setItem('token', token);
  }, 40);
})


export default viewRouter
